<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            margin: 0;
        }
        .c1{
            border: red solid 1px;
            height: 300px;
            width: 300px;
            /*文本位置设置*/
            text-align: center;
            line-height: 300px;
            /*内边距设置*/
            /*padding: 50px;*/
            /*向上扩100像素*/
            /*padding-top: 100px;*/
            /*上右下左，顺时针*/
            padding: 10px 20px 30px 40px;
            /*整个盒子居中*/
            margin: 100px auto;
        }

        .c2{
            background-color: gray;
        }

        .c3{
            height: 200px;
            width: 200px;
            background-color: red;
            /*外边距 可以设置负值*/
            margin: -20px;
        }
    </style>
</head>
<body>

<!--
外边距：margin
内边距：padding
-->
<!--内边距-->
<div class="c1">
    <div class="c2">yuan</div>
</div>

<!--外边距-->
<div class="c3"></div>

</body>
</html>